import java.util.*;

/**
 * @author LKQ
 * @date 2022/6/14 16:41
 * @description
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            int n = sc.nextInt();
            int cnt = 0, ans = 0;
            while (n != 0) {
                if ((n & 1) == 1) {
                    cnt++;
                }else {
                    cnt = 0;
                }
                ans = Math.max(ans, cnt);
                n >>= 1;
            }
            System.out.println(ans);
        }
    }
}
